<!DOCTYPE HTML>
<html>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Textillate.js</title>
  <link href="assets/animate.css" rel="stylesheet">
  <link href="assets/style.css" rel="stylesheet">
  <link href='http://fonts.googleapis.com/css?family=Rokkitt' rel='stylesheet' type='text/css'>
  <body>
    <div class="decal"></div>
		<div class="jumbotron">
			<div class="container">
  		  <h1 class="glow in tlt">textillate.js</h1>
  		  <p class="tlt" data-in-effect="bounceInDown">
  		  	A simple plugin for CSS3 text animations.
  		  </p>
        <div>
          <a href="https://github.com/jschr/textillate" class="btn fade in">Download on Github</a>
        </div>
        <div>
          <a
            class="twitter-share-button"
            href="https://twitter.com/share"
            data-text="Textillate.js - A simple plugin for CSS3 text animations"
            data-url="http://textillate.js.org"
            data-via="_jschr">
            Tweet
          </a>&nbsp;&nbsp;
          <iframe
            src="https://ghbtns.com/github-btn.html?user=jschr&repo=textillate&type=star&count=true&v=2"
            frameborder="0"
            scrolling="0"
            width="100px"
            height="20px">
          </iframe>
          <iframe
            src="https://ghbtns.com/github-btn.html?user=jschr&repo=textillate&type=fork&count=true"
            frameborder="0"
            scrolling="0"
            width="90px"
            height="20px">
          </iframe>
        </div>
  		</div>
  	</div>
    <div class="decal"></div>
  	<div class="container fade in">
      <div class="about">
        <div class="grid grid-pad">
          <section class="col-1-3">
            <h2>About</h2>
            <p>Textillate.js combines some awesome libraries to provide a ease-to-use plugin for applying CSS3 animations to any text.</p>
          </section>
          <section class="col-1-3">
            <h2>Usage</h2>
            <p>Simply include textillate.js and it's dependencies in your project to start creating unqiue effects.</p>
          </section>
          <section class="col-1-3">
            <h2>Credits</h2>
            <p>Textillate.js is built on top of the simple, yet amazingly powerful <a href="http://daneden.me/animate">animate.css</a> and <a href="http://letteringjs.com">lettering.js</a> libraries.</p>
          </section>
        </div>
      </div>
      <!--<div class="grid grid-pad">
        <section class="col-1-1">
          <h2>Examples</h2>
          <pre><code class="xml"><span id="example">Some Text</span></code></pre>
          <pre><code class="javascript">$('#example').textillate()</code></pre>
        </section>
      </div>-->
      <div class="grid grid-pad">
        <section class="col-1-1">
            <h2>Playground</h2>
            <div class="playground grid">
              <div class="col-1-1 viewport">
                  <div class="tlt">
                    <ul class="texts" style="display: none">
                      <li data-id="wizard">Grumpy wizards make toxic brew for the evil Queen and Jack.</li>
                      <li data-id="fox">The quick brown fox jumps over the lazy dog.</li>
                    </ul>
                  </div>
              </div>
              <div class="col-1-1 controls" style="padding-right: 0">
                <form class="grid grid-pad">
                  <div class="control col-1-2">
                    <label>In Animation</label>
                    <select data-key="effect" data-type="in"></select>
                    <select data-key="type" data-type="in">
                      <option value="">sequence</option>
                      <option value="reverse">reverse</option>
                      <option value="sync">sync</option>
                      <option value="shuffle">shuffle</option>
                    </select>
                  </div>
                  <div class="control col-1-2">
                    <label>Out Animation</label>
                    <select data-key="effect" data-type="out"></select>
                    <select data-key="type" data-type="out">
                      <option value="">sequence</option>
                      <option value="reverse">reverse</option>
                      <option value="sync">sync</option>
                      <option selected="selected" value="shuffle">shuffle</option>
                    </select>
                  </div>
                </form>
              </div>
            </div>
        </section>
      </div>
      <div class="grid grid-pad">
        <section class="col-1-1 deps">
            <h2>Dependencies</h2>
            <p>Textillate.js depends on the following libraries: </p>
            <div>
              <ul>
                <li><a href="http://jquery.com/">jQuery</a></li>
                <li><a href="http://daneden.me/animate/">animate.css</a>, by Daniel Eden</li>
                <li><a href="http://letteringjs.com/">lettering.js</a>, by Dave Rupert</li>
              </ul>
            </div>
        </section>
      </div>
  	</div>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="assets/jquery.fittext.js"></script>
<script src="assets/jquery.lettering.js"></script>
<script src="http://yandex.st/highlightjs/7.3/highlight.min.js"></script>
<script src="jquery.textillate.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script>
  $(function (){
    var log = function (msg) {
      return function () {
        if (console) console.log(msg);
      }
    }
    $('code').each(function () {
      var $this = $(this);
      $this.text($this.html());
    })

    var animateClasses = 'flash bounce shake tada swing wobble pulse flip flipInX flipOutX flipInY flipOutY fadeIn fadeInUp fadeInDown fadeInLeft fadeInRight fadeInUpBig fadeInDownBig fadeInLeftBig fadeInRightBig fadeOut fadeOutUp fadeOutDown fadeOutLeft fadeOutRight fadeOutUpBig fadeOutDownBig fadeOutLeftBig fadeOutRightBig bounceIn bounceInDown bounceInUp bounceInLeft bounceInRight bounceOut bounceOutDown bounceOutUp bounceOutLeft bounceOutRight rotateIn rotateInDownLeft rotateInDownRight rotateInUpLeft rotateInUpRight rotateOut rotateOutDownLeft rotateOutDownRight rotateOutUpLeft rotateOutUpRight hinge rollIn rollOut';

    var $form = $('.playground form')
      , $viewport = $('.playground .viewport');

    var getFormData = function () {
      var data = {
        loop: true,
        in: { callback: log('in callback called.') },
        out: { callback: log('out callback called.') }
      };

      $form.find('[data-key="effect"]').each(function () {
        var $this = $(this)
          , key = $this.data('key')
          , type = $this.data('type');

          data[type][key] = $this.val();
      });

      $form.find('[data-key="type"]').each(function () {
        var $this = $(this)
          , key = $this.data('key')
          , type = $this.data('type')
          , val = $this.val();

          data[type].shuffle = (val === 'shuffle');
          data[type].reverse = (val === 'reverse');
          data[type].sync = (val === 'sync');
      });

      return data;
    };

    $.each(animateClasses.split(' '), function (i, value) {
      var type = '[data-type]'
        , option = '<option value="' + value + '">' + value + '</option>';

      if (/Out/.test(value) || value === 'hinge') {
        type = '[data-type="out"]';
      } else if (/In/.test(value)) {
        type = '[data-type="in"]';
      }

      if (type) {
        $form.find('[data-key="effect"]' + type).append(option);
      }
    });

    $form.find('[data-key="effect"][data-type="in"]').val('fadeInLeftBig');
    $form.find('[data-key="effect"][data-type="out"]').val('hinge');

    $('.jumbotron h1')
      .fitText(0.5)
      .textillate({ in: { effect: 'flipInY' }});

    $('.jumbotron p')
      .fitText(3.2, { maxFontSize: 18 })
      .textillate({ initialDelay: 1000, in: { delay: 3, shuffle: true } });

    setTimeout(function () {
        $('.fade').addClass('in');
    }, 250);

    setTimeout(function () {
      $('h1.glow').removeClass('in');
    }, 2000);

    var $tlt = $viewport.find('.tlt')
      .on('start.tlt', log('start.tlt triggered.'))
      .on('inAnimationBegin.tlt', log('inAnimationBegin.tlt triggered.'))
      .on('inAnimationEnd.tlt', log('inAnimationEnd.tlt triggered.'))
      .on('outAnimationBegin.tlt', log('outAnimationBegin.tlt triggered.'))
      .on('outAnimationEnd.tlt', log('outAnimationEnd.tlt triggered.'))
      .on('end.tlt', log('end.tlt'));

    $form.on('change', function () {
      var obj = getFormData();
      $tlt.textillate(obj);
    }).trigger('change');

  });

	</script>
  <script>
    window.twttr=(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],t=window.twttr||{};if(d.getElementById(id))return t;js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);t._e=[];t.ready=function(f){t._e.push(f);};return t;}(document,"script","twitter-wjs"));
  </script>
  </body>
</html>
